import {getMedicineList,addMedicine,deleteMedicine} from "@/api";
const state={
    medicineList:[],
    total:undefined,
};
const mutations={
    //获取所有药品信息
    GETMEDICINELIST(state,data){
        state.medicineList=data.data;
        state.total=data.total;
    }
};
const actions={
    //获取所有药品信息
    async getMedicineList({commit},params){
        let {data}=await getMedicineList(params);
        console.log(data)
        if(data.code===200){
            commit('GETMEDICINELIST',data)
        }
    },
    //添加|修改药品
    async addMedicine({commit},params){
        let {data}=await addMedicine(params);
    },
    //删除药品信息
    async deleteMedicine({commit},params){
        let {data}=await deleteMedicine(params);
    }
};
const getters={};
export default {
    state,
    mutations,
    actions,
    getters
}